<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>计算一个给定的x.509证书的指纹或摘要</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.openssl-x509-fingerprint" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_x509_fingerprint</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.6.0, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_x509_fingerprint</span> &mdash; <span class="dc-title">计算一个给定的x.509证书的指纹或摘要</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.openssl-x509-fingerprint-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_x509_fingerprint</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$x509</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$hash_algorithm</code><span class="initializer"> = &quot;sha1&quot;</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$raw_output</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
  ]] ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>openssl_x509_fingerprint()</strong></span> 返回<code class="parameter">x509</code>的字符串类型的摘要。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-x509-fingerprint-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
<dt>
<code class="parameter">x509</code></dt>

<dd>

 <p class="para">
  参见<a href="openssl.certparams.html" class="link">密钥／证书参数</a>以获取有效值列表。
 </p>
</dd>


    
     <dt>
<code class="parameter">hash_algorithm</code></dt>

     <dd>

      <p class="para">
       使用的摘要方法或散列算法，比如， &quot;sha256&quot;, <span class="function"><a href="openssl_get_md_methods.html" class="function">openssl_get_md_methods()</a></span>摘要算法之一。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">raw_output</code></dt>

     <dd>

      <p class="para">
      设置为 <strong><code>TRUE</code></strong>时，输出原始二进制数据。设置为 <strong><code>FALSE</code></strong>时，输出小写的16进制字符串。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-x509-fingerprint-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
    将包含计算的证书指纹的字符串返回为小写16进制格式，除非将<code class="parameter">raw_output</code>设置为TRUE，在这种情况下会返回消息摘要的原始二进制表示形式。
  </p>
  <p class="para">
    失败则返回 <strong><code>FALSE</code></strong> .
  </p>
 </div>


</div></div></div></body></html>